/**
 * 
 */
package net.cloudcodex.client.cdo;

import java.util.Date;
import java.util.List;
import java.util.Map;

import net.cloudcodex.shared.dto.campaign.character.CharacterDescriptionDTO;
import net.cloudcodex.shared.dto.campaign.character.CharacterHeaderDTO;
import net.cloudcodex.shared.dto.campaign.character.CharacterNoteDTO;
import net.cloudcodex.shared.dto.campaign.character.CompleteCharacterDescriptionDTO;

/**
 * @author dweltz
 * 
 */
public class CharacterCDO {

	private CharacterHeaderDTO characterHeaderDTO ;
	private CharacterDescriptionDTO characterDescriptionDTO;

	public CharacterCDO(CompleteCharacterDescriptionDTO completeCharacterDescriptionDTO) {
		this(completeCharacterDescriptionDTO.getHeader(),completeCharacterDescriptionDTO.getDescription());

	}
	public CharacterCDO(CharacterHeaderDTO characterHeaderDTO,CharacterDescriptionDTO characterDescriptionDTO){
		this.characterHeaderDTO = characterHeaderDTO;
		this.characterDescriptionDTO = characterDescriptionDTO;
	}
	
	public String getOwnerNickName(){
		return characterHeaderDTO.getOwnerNickname();
	}
	public String getIcon() {
		return characterHeaderDTO.getIcon();
	}

	public String getName() {
		return characterHeaderDTO.getName();
	}

	public String getPublicDescription() {
		if (characterHeaderDTO!=null){
			characterHeaderDTO.getDescription();
		}
		return null;
	}

	public String getPrivateDescription() {
		if(characterDescriptionDTO!=null){
			characterDescriptionDTO.getSheet();
		}
		return null;
	}
	
	public List<CharacterNoteDTO> getNotes() {
			
		return characterDescriptionDTO.getNotes(); 
	}

	public Date getTimeStamp(){
		return characterDescriptionDTO.getTimestamp();
	}
	
	public Long getOwnerId (){
		return characterHeaderDTO.getOwner();
	}
	public void updateCharacterPublicDescription(String description) {
		this.characterHeaderDTO.setDescription(description);
		
	}
	public long getId() {
		return characterHeaderDTO.getId();
	}
	
	public boolean isActive(){
		return characterHeaderDTO.getOwner()!= null ;
	}
	
	public boolean isProfile(){
		return characterHeaderDTO.isProfile();
	}

	public boolean isLocked(){
		if (characterHeaderDTO.getLocked()==null){
			return false ;
		}
		
		return characterHeaderDTO.getLocked();
	}
	
	public boolean isDead(){
		if (characterHeaderDTO.getDead()== null){
			return false ;
		}
		return characterHeaderDTO.getDead();
	}
	
	
	public long getCampaignID(){
		return characterDescriptionDTO.getCampaignId();
	}
	
	public Map<Long, String> getAliases (){
		return characterDescriptionDTO.getAliases();
	}
	public void setCharacterDescriptionDTO(
			CharacterDescriptionDTO characterDescriptionDTO) {
		this.characterDescriptionDTO = characterDescriptionDTO;
	}
	public void setPublicDescription(String description) {
		this.characterHeaderDTO.setDescription(description);
	}

}